#ifndef __BSP_UART_H
#define __BSP_UART_H

#include "gpio.h"
#include "uart.h"
#include "lpuart.h"
#include <stdbool.h>
#include "bsp_timer.h"

#ifdef RTOS

#include "FreeRTOS.h"
#include "task.h"
#include "timers.h"
#include "queue.h"
#include "semphr.h"
#include "event_groups.h"
#include "FreeRTOSConfig.h"


/************************此部分接口移植部分**********************************/

#define RXBUFF_MAXSize  1000  // 接收OTA升级包需要大量空间

typedef struct
{
	uint16_t     rx_len;  /*实际使用量*/
	uint8_t      Recv[RXBUFF_MAXSize];
}stcATBuff;

extern stcATBuff AT_RXbuff;

#endif

/*用于空闲中断判断*/
typedef struct
{
	uint16_t     uart_cnt;  
	uint16_t     timer_cnt;
}stcUART_Idle; 

extern stcUART_Idle UART_Idle;

void BSP_LPUART0_GPIO_Init(void);

void BSP_LPUART1_GPIO_Init(void);

void BSP_UART0_GPIO_Init(void);

void BSP_UART1_GPIO_Init(void);

void BSP_LPUARTx_Init(M0P_LPUART_TypeDef* LPUARTx, uint32_t baud, en_lpuart_mmdorck_t EvenOdd);

void BSP_UARTx_Init(M0P_UART_TypeDef *UARTx, uint32_t baud, en_uart_mmdorck_t Parity); 

void BSP_LPUARTx_SendBytes(M0P_LPUART_TypeDef* LPUARTx, uint8_t *SendBuff, uint32_t ByteLength);

void BSP_UARTx_SendBytes(M0P_UART_TypeDef* UARTx, uint8_t *SendBuff,uint32_t ByteLength);

void BSP_UARTx_Putstr(M0P_UART_TypeDef* UARTx, char *str);

#endif

